from django.contrib import admin
from import_export import resources
from import_export.admin import ImportExportModelAdmin

from .models import Book, Author, Category


class BookResource(resources.ModelResource):

    class Meta:
        model = Book


class AuthorResource(resources.ModelResource):

    class Meta:
        model = Author


class CategoryResource(resources.ModelResource):

    class Meta:
        model = Category


class BookAdmin(ImportExportModelAdmin):
    resource_classes = [BookResource]


class AuthorAdmin(ImportExportModelAdmin):
    resource_classes = [AuthorResource]


class CategoryAdmin(ImportExportModelAdmin):
    resource_classes = [CategoryResource]


admin.site.register(Book, BookAdmin)
admin.site.register(Author, BookAdmin)
admin.site.register(Category, BookAdmin)
